package com.zw.chat.common.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * @author by: zyl
 * @ClassName: BaseEntity
 * @Description: 通用实体类
 * @Date: 2024/12/5 9:49
 */
@Data
public class BaseEntity implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @Id
    private String id;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @Override
    public boolean equals(Object obj) {
        return obj instanceof BaseEntity && this.id.equals(((BaseEntity) obj).getId());
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }
}
